home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
FinderFlocks
/
CFlock.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-23
|
1KB
|
39 lines
#pragma once /*prevents multiple inclusions of this file */
#include "FlockUtils.h"
#include "CBoid.h"
#define kMaxBoids 100 // The maximum number of boids allowed
class CFlock
{
public:
CFlock(void);
virtual ~CFlock(void);
ControlRec fControls; // The Raw Flock Controls, 0-100
ControlRec fGoodControls; // The processed Flock Controls
CFlock *InitFlock(RgnHandle);
OSErr FlockStep(RgnHandle);
void ShakeFlock(void);
void KillFlock(RgnHandle blankRgn);
OSErr ControlsChanged(ControlRec *newControls, RgnHandle); // Call when controls change
protected:
CBoid *fTheBoids[kMaxBoids]; // array of boids
Rect fMasterFlockRect; // the rect describing the world extent
Rect fFlockRect; // the rect describing the world extent, adjusted
// for the boid size
long fNumBoids; // the number of active boids
double fMaxEffort; // the amount of "oomph" a boid can expend each step
double fAwareDist; // the true distance boids can see
double fAwareDistSquared; // the distance boids can see squared
double fComfyDist; // the true inter-boid distance
double fComfyDistSquared; // the inter-boid distance squared
void FindNeighbors(void);
void FlyHome(RgnHandle blankRgn);
};